<template>
	<el-dialog :title="titleMap[mode]" v-model="visible" :width="500" destroy-on-close @closed="$emit('closed')">
		<el-form :model="form" :rules="rules" :disabled="mode=='show'" ref="dialogForm" label-width="100px" label-position="left">
			<el-form-item label="角色名称" prop="name">
				<el-input v-model="form.name" clearable></el-input>
			</el-form-item>
			<el-form-item label="排序" prop="orderNum">
				<el-input-number v-model="form.orderNum" :min="1"></el-input-number>
			</el-form-item>			
			<el-form-item label="成员数" prop="memberCount">
				<el-input v-model="form.memberCount" clearable type="input"></el-input>
			</el-form-item>
			<el-form-item label="更新时间" prop="updateTime">
				<el-input v-model="form.updateTime" type="input"></el-input>				
			</el-form-item>
			<el-form-item label="创建时间" prop="createTime">
				<el-input v-model="form.createTime" clearable type="input"></el-input>
			</el-form-item>
			<el-form-item label="备注" prop="remark">
				<el-input v-model="form.remark" clearable type="textarea"></el-input>
			</el-form-item>
		</el-form>
		<template #footer>
			<el-button @click="visible=false" >取 消</el-button>
		</template>
	</el-dialog>
</template>

<script>
	export default {
		emits: ['success', 'closed'],
		data() {
			return {
				mode: "show",
				titleMap: {
					add: '新增',
					edit: '编辑',
					show: '查看'
				},
				visible: false,
				form: {}
			}
		},
		mounted() {

		},
		methods: {
			//显示
			open(mode='show'){
				this.mode = mode;
				this.visible = true;
				return this
			},
			//表单注入数据
			setData(data){
				//合并数据项
				Object.assign(this.form, data)
			}
		}
	}
</script>

<style>
</style>
